<template>
    <div class="home">
        <!-- 头部 -->
        <Top></Top>
        <!-- 内容展示 -->
        <div class="container">
            <div class="menu scroll-container">
                <!-- :default-active="menu[0].frontEndRouter" :collapse="false" :default-openeds="defaultOpeneds" -->
                <el-menu :default-active="$route.fullPath" class="el-menu-vertical-demo">
                    <Menu :menuList="menu"></Menu>
                </el-menu>
            </div>
            <div class="router-content">
                <router-view></router-view>
            </div>
        </div>
    </div>
</template>
<script>
import { mapState, mapGetters } from 'vuex';
import Menu from './menu/index.vue'
export default {
    name: 'Home',
    components: {
        Menu
    },
    mixins: [],
    props: {

    },
    data() {
        return {
            defaultOpeneds: ['']
        }
    },
    computed: {
        ...mapState('userStore', ['menu']),
    },
    watch: {

    },
    mounted() {
    },
    methods: {
        handleOpen(key, keyPath) {
            // 当打开一个菜单时，关闭其他所有打开的菜单
            this.defaultOpeneds = [keyPath[0]];
        },
    },
    beforeDestroy() {

    }
};
</script>
<style lang='less' scoped>
.home {
    background-color: #f8f8ff;
    width: 100%;
    height: 100vh;

    .el-menu {
        border-right: none;
    }

    .container {
        width: 100%;
        display: flex;
        padding-top: 70px;
        justify-content: space-between;

        .menu {
            flex: 2;
            height: 90vh;
            background-color: white;
        }

        /*隐藏滚动条*/
        .scroll-container {
            overflow: auto;
        }

        /* 针对WebKit内核浏览器隐藏滚动条 */
        .scroll-container::-webkit-scrollbar {
            display: none;
        }

        /* 针对IE和Edge隐藏滚动条 */
        .scroll-container {
            -ms-overflow-style: none;
            /* IE and Edge */
        }

        .router-content {
            flex: 11;
            padding: 10px;
            background-color: #f8f8ff;
        }

    }
}
</style>